<?php
/**
 *Modelo de Categoria
 *@author Luis Gabriel Rodriguez <luisgabriel84@gmail.com>
 */
class Category extends AppModel {

	var $name = 'Category';
        /**
        * @var array Reglas de validacion
        * @access public
        */
	var $validate = array(
		'parent_id' => array('numeric'),
		'lft' => array('numeric'),
		'rght' => array('numeric'),
		'name' => array('notempty'),
		'slug' => array('notempty'),
		'section' => array('numeric')
	);
        /**
        * @var array
        * @access public
        */
        var $actsAs = array('Tree');

        /**
        * @var array Mapeo relacional
        * @access public
        */
	var $belongsTo = array(
		'Parent' => array(
			'className' => 'Category',
			'foreignKey' => 'parent_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		)
	);
        /**
        * @var array Mapeo relacional
        * @access public
        */
        var $hasMany = array(
			'Product' => array('className' => 'Product',
								'foreignKey' => 'category_id',
								'dependent' => false,
								'conditions' => '',
								'fields' => '',
								'order' => '',
								'limit' => '',
								'offset' => '',
								'exclusive' => '',
								'finderQuery' => '',
								'counterQuery' => ''
			)
	);

}
?>